package com.fzb.forum4j.incp;

import org.apache.struts2.interceptor.FileUploadInterceptor;

import com.fzb.forum4j.controller.CommonsAction;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionInvocation;

public class FileUpInterceptor extends FileUploadInterceptor{

	/**
	 * 用于文件上传拦截器
	 */
	private static final long serialVersionUID = 1L;

	@SuppressWarnings("unchecked")
	@Override
	public String intercept(ActionInvocation invocation) throws Exception {
		
		((CommonsAction)ActionContext.getContext().getValueStack().getRoot().get(0)).prepare();
		invocation.getStack().push(((CommonsAction)ActionContext.getContext().getValueStack().getRoot().get(0)).getModel());
		String str=invocation.invoke();
		System.out.println("文件上传");
		return str;
	}
}
